From d9615d70f311ad80fba943fbb5c3df477786d9c9 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Thu, 24 Sep 2015 23:47:50 +0200 Subject: [PATCH] Use std::env::EXE_SUFFIX in new tests --- tests/test_cargo_clean.rs | 18 ++++++++++++------ tests/test_cargo_compile.rs | 14 +++++++++----- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/tests/test_cargo_clean.rs b/tests/test_cargo_clean.rs index 4b2828a6e..ff3313d99 100644 --- a/tests/test_cargo_clean.rs +++ b/tests/test_cargo_clean.rs @@ -1,3 +1,5 @@ +use std::env; + use support::{project, execs, main_file, basic_bin_manifest}; use hamcrest::{assert_that, existing_dir, existing_file, is_not}; @@ -74,16 +76,20 @@ test!(clean_multiple_packages { .arg("-p").arg("foo"), execs().with_status(0)); + let d1_path = &p.build_dir().join("debug").join("deps") + .join(format!("d1{}", env::consts::EXE_SUFFIX)); + let d2_path = &p.build_dir().join("debug").join("deps") + .join(format!("d2{}", env::consts::EXE_SUFFIX)); + + assert_that(&p.bin("foo"), existing_file()); - assert_that(&p.build_dir().join("debug").join("deps").join("d1"), existing_file()); - assert_that(&p.build_dir().join("debug").join("deps").join("d2"), existing_file()); + assert_that(d1_path, existing_file()); + assert_that(d2_path, existing_file()); assert_that(p.cargo("clean").arg("-p").arg("d1").arg("-p").arg("d2") .cwd(&p.root().join("src")), execs().with_status(0).with_stdout("")); assert_that(&p.bin("foo"), existing_file()); - assert_that(&p.build_dir().join("debug").join("deps").join("d1"), - is_not(existing_file())); - assert_that(&p.build_dir().join("debug").join("deps").join("d2"), - is_not(existing_file())); + assert_that(d1_path, is_not(existing_file())); + assert_that(d2_path, is_not(existing_file())); }); diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index affa96bc9..cd1714c18 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1975,12 +1975,16 @@ test!(build_multiple_packages { assert_that(process(&p.bin("foo")).unwrap(), execs().with_stdout("i am foo\n")); - assert_that(&p.build_dir().join("debug").join("deps").join("d1"), existing_file()); - assert_that(process(&p.build_dir().join("debug").join("deps").join("d1")).unwrap(), - execs().with_stdout("d1")); + let d1_path = &p.build_dir().join("debug").join("deps") + .join(format!("d1{}", env::consts::EXE_SUFFIX)); + let d2_path = &p.build_dir().join("debug").join("deps") + .join(format!("d2{}", env::consts::EXE_SUFFIX)); - assert_that(&p.build_dir().join("debug").join("deps").join("d2"), existing_file()); - assert_that(process(&p.build_dir().join("debug").join("deps").join("d2")).unwrap(), + assert_that(d1_path, existing_file()); + assert_that(process(d1_path).unwrap(), execs().with_stdout("d1")); + + assert_that(d2_path, existing_file()); + assert_that(process(d2_path).unwrap(), execs().with_stdout("d2")); }); -- 2.30.2